﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;

namespace RMAS
{
    public enum LVS_EX
    {
        LVS_EX_GRIDLINES = 1,
        LVS_EX_SUBITEMIMAGES,
        LVS_EX_CHECKBOXES = 4,
        LVS_EX_TRACKSELECT = 8,
        LVS_EX_HEADERDRAGDROP = 16,
        LVS_EX_FULLROWSELECT = 32,
        LVS_EX_ONECLICKACTIVATE = 64,
        LVS_EX_TWOCLICKACTIVATE = 128,
        LVS_EX_FLATSB = 256,
        LVS_EX_REGIONAL = 512,
        LVS_EX_INFOTIP = 1024,
        LVS_EX_UNDERLINEHOT = 2048,
        LVS_EX_UNDERLINECOLD = 4096,
        LVS_EX_MULTIWORKAREAS = 8192,
        LVS_EX_LABELTIP = 16384,
        LVS_EX_BORDERSELECT = 32768,
        LVS_EX_DOUBLEBUFFER = 65536,
        LVS_EX_HIDELABELS = 131072,
        LVS_EX_SINGLEROW = 262144,
        LVS_EX_SNAPTOGRID = 524288,
        LVS_EX_SIMPLESELECT = 1048576
    }
    [ToolboxBitmap(typeof(ListView))]
    public class ListViewXP : ListView
    {
        private LVS_EX styles;
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern int SendMessage(IntPtr handle, int messg, int wparam, int lparam);
        public void SetExStyles()
        {
            this.styles = (LVS_EX)ListViewXP.SendMessage(base.Handle, 4151, 0, 0);
            this.styles |= (LVS_EX)98304;
            ListViewXP.SendMessage(base.Handle, 4150, 0, (int)this.styles);
        }
        public void SetExStyles(LVS_EX exStyle)
        {
            this.styles = (LVS_EX)ListViewXP.SendMessage(base.Handle, 4151, 0, 0);
            this.styles |= exStyle;
            ListViewXP.SendMessage(base.Handle, 4150, 0, (int)this.styles);
        }
    }
}
